package com.souvc.xstream;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamConverter;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
import com.thoughtworks.xstream.converters.basic.BooleanConverter;

import java.util.Arrays;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.List;

/**
 * 测试 boolean 类型自定义注解
 */
@XStreamAlias("message")
public class RendezvousMessage7 {

    @XStreamAlias("type")
    private int messageType;


    @XStreamImplicit(itemFieldName="part")
    private List<String> content;

    //添加 boolean 类型自定义注解
    @XStreamConverter(value=BooleanConverter.class, booleans={false}, strings={"yes", "no"})
    private boolean important;

    @XStreamConverter(SingleValueCalendarConverter.class)
    private Calendar created = new GregorianCalendar();

    public RendezvousMessage7(int messageType, boolean important, String... content) {
        this.messageType = messageType;
        this.important = important;
        this.content = Arrays.asList(content);
    }
}
